<?php
class ControllersTest extends ControllersBase {

    public $a='bb';
    public $users,$user;

    /**
     * 初始化
     *
     */
    protected function init() {
        parent::init();       
        $this->layout = 'index';
    }    

    public function index(){
        $count = $this->model->query('select count(*) from users')->fetchColumn();

        $this->model->table('users')->insert(array('name'=>date('Y-m-d H:i:s'), 'pass'=>md5('test')));
        
        $this->model->table('users')->delete(array(array('id',3)));

        $this->model->table('users')->update(array('name'=>'test'), array(array('id','4')));

        $all = $this->model->table('users')->where('name','test')->all();

        $all = $this->model->table('users')->fetchAll(array(
            'cols' => array('id','name'),
            'where'=> array(array('name','test%', 'like')),
            'order'=> 'id desc',
            'limit'=>'0,10',
        ));
        $all = $this->model->changeDb('slave')->table('roles')->fetchAll();
        print_r($all);
        $this->view = 'index';
    }

    public function edit() {
        exit('hello world!');
    }
    
}
